We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.

Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)

Bug 3392608 - multi-section bin format: two sections following the same section, one implicitly, gives wrong error message
Summary: multi-section bin format: two sections following the same section, one implic...
Status: OPEN
Alias: None
Product: NASM
Classification: Unclassified
Component: Assembler (show other bugs)
Version: 2.15.xx
Hardware: All All
: Medium minor
Assignee: nobody
URL:
Depends on:
Blocks:
 
Reported: 2019-09-09 13:26 PDT by E. C. Masloch
Modified: 2019-09-09 13:40 PDT (History)
5 users (show)

Obtained from: Built from git using configure
Generated by: ---
Bug category:
Observed for: ---
Regression: ---
Regression since:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E. C. Masloch 2019-09-09 13:26:04 PDT
I think what is happening here is that upon the first definition of the section FREE it is assumed to follow after DATA2. Then the definition of DATA3, which explicitly follows DATA2, fails because only one of them may follow DATA2.

The section names listed in the error message don't seem correct for this condition however.


$ cat test.asm
section FAT
start_fat:
section DATA1 follows=FAT
start_data1:
section DATA2 follows=DATA1
start_data2:
section FREE
start_free:
section DATA3 follows=DATA2
start_data3:
section FREE follows=DATA3
$ nasm -v
NASM version 2.12.01
$ nasm test.asm
nasm: fatal: sections DATA3 and DATA3 can't both follow section DATA2
$ newnasm -v
NASM version 2.15rc0 compiled on Aug 21 2019
$ newnasm test.asm
test.asm: fatal: sections DATA3 and DATA3 can't both follow section DATA2
$
Comment 1 E. C. Masloch 2019-09-09 13:34:37 PDT
I tried something else. Same error message, but I'm not sure what to make of it in this case. It seems wrong. (Maybe the follows=DATAEND before defining that section is silently downgraded to "follows=DATA2" and thus hits the error again?)


$ newnasm test2.asm
test2.asm: fatal: sections DATA3 and DATA3 can't both follow section DATA2
$ cat test2.asm
section FAT
start_fat:
section DATA1 follows=FAT
start_data1:
section DATA2 follows=DATA1
start_data2:
section FREE follows=DATAEND
start_free:
section DATA3 follows=DATA2
start_data3:
section DATAEND follows=DATA3
start_dataend:
$ nasm -v
NASM version 2.12.01
$ nasm test2.asm
nasm: fatal: sections DATA3 and DATA3 can't both follow section DATA2
$ newnasm -v
NASM version 2.15rc0 compiled on Aug 21 2019
$ newnasm test2.asm
test2.asm: fatal: sections DATA3 and DATA3 can't both follow section DATA2
$
Comment 2 E. C. Masloch 2019-09-09 13:37:24 PDT
This however works:


$ cat test3.asm
section FREE follows=DATAEND
start_free:
section DATAEND
start_dataend:
$ nasm -v
NASM version 2.12.01
$ nasm test3.asm
$ newnasm -v
NASM version 2.15rc0 compiled on Aug 21 2019
$ newnasm test3.asm
$
Comment 3 E. C. Masloch 2019-09-09 13:40:58 PDT
Another failing case:


$ cat test4.asm
section DATA2
start_data2:
section FREE follows=DATAEND
start_free:
section DATAEND follows=DATA2
start_dataend:
$ nasm -v
NASM version 2.12.01
$ nasm test4.asm
nasm: fatal: sections DATAEND and DATAEND can't both follow section DATA2
$ newnasm -v
NASM version 2.15rc0 compiled on Aug 21 2019
$ newnasm test4.asm
test4.asm: fatal: sections DATAEND and DATAEND can't both follow section DATA2
$